<?php if (!defined('THINK_PATH')) exit();?><html>
    <head>
        <meta charset="utf-8">
        <title>注册</title>
    </head>
    <body>
        <h1>首页测试</h1>
        <p>/Home/Index</p>
        <p>/Home/Index</p>
        <p>/Public</p>

        <div>
            <input type="text" name="name" placeholder="用户名">
            <input type="text" name="password1" placeholder="密码">
            <input type="text" name="password2" placeholder="确认密码">
            <input type="text" name="phone" placeholder="电话">
            <input type="text" name="email" placeholder="邮箱">
            <input type="text" name="code" placeholder="验证码">
            <img src="/Home/Index/vercode?<?php echo rand();?>" onclick="this.src='/Home/Index/vercode?rand='+(Math.random()*1000)" alt="验证码" title="点击刷新">
            <button id="btn">提交</button>
        </div>
        <script src="/Public/js/jquery-1.11.3.js"></script>
        <script>
            $(function(){
                $('#btn').on('click', function(e){
                    e.preventDefault();
                    $.ajax({
                        url: '/Home/Index/reg',
                        type: 'POST',
                        data: {
                            code: $('input[name=code]').val(),
                            name: $('input[name=name]').val(),
                            password1: $('input[name=password1]').val(),
                            password2: $('input[name=password2]').val(),
                            phone: $('input[name=phone]').val(),
                        },
                        dataType: 'JSON',
                        success: function(data){
                            console.log(data);
                        }
                    });
                });
            });
        </script>
    </body>
</html>